/*************************************************************************
 * File Name:    1006.cc
 * Author:       zero91
 * Mail:         jianzhang9102@gmail.com
 * Created Time: Sat 28 Sep 2013 12:32:32 PM CST
 * 
 * Description:  
 ************************************************************************/

#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>

using namespace std;

int
main(int argc, char *argv[])
{
    int N, k;

    while (scanf("%d %d", &N, &k) != EOF) {
        if (N == 0 && k == 0) break;
        N %= k + 1;
        if (N == 1) printf("Jiang\n");
        else printf("Tang\n");
    }
    return 0;
}
